interface Duck {
  walk: () => void;
  quack: () => void;
}

function doDuckThings(duck: Duck) {
  duck.quack();
  duck.walk();
}

const myDuck = {
  walk: () => console.log("Walking like a duck"),
  quack: () => console.log("Quacking like a duck"),
  swim: () => console.log("Swimming like a duck"),
};

doDuckThings(myDuck);
